<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.tss.util.*"%>
<%@page import="com.jedi.*"%>
<%@page import="com.store.*"%>
<%@page import="com.store.ContractMgr"%>
<%@page import="com.store.Contract"%>
<%@page import="com.store.*"%>
<%@page import="java.util.*"%>
<%@page import="java.io.File"%>
<%@include file="../global_var.jsp"%>
<%@include file="../check_login.jsp"%>
<%
int pageno=Integer.parseInt((String)(session.getAttribute("pageno")));//页码
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
ContractMgr contractMgr = new ContractMgr();
String conid = ParamUtils.getParameter(request,"conid","");
Contract contract = contractMgr.get(conid) ;
User just_user = (User)session.getAttribute("LoginUser");
String power_enable_id = "10002";//察看本人
String power1_enable_id = "10102";//察看全部
String power2_enable_id = "10006";//损益分析


String strErr = "";
if (contract == null || contract.getId().trim().equals("")) strErr = "此合同信息不存在!";
Pala pala = new Pala("conid");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    
<title>My JSP 'techcontract_add.jsp' starting page</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <link href="style/main.css" rel="stylesheet" type="text/css">
	<script language="javascript" src="js/common.js"></script>
   <script language="javascript" >
   function clk_goback() {
	//location.href="incon_list.jsp";
location.href="incon_list.jsp?mgh="+operatorForm.pageno.value;
	}
   function clk_submit() {
	var oForm = document.operatorForm;
	oForm.cmd.value = "insert";
	return true;
	}
function clk_anaysis(conid,spartfee,outefee) {
	location.href = "../analysis_mgt/pala_add.jsp?conid=" + conid+"&spartfee="+spartfee+"&outefee="+outefee;
}
function clk_view_anaysis(conid) {
	location.href = "../analysis_mgt/palav_detail.jsp?conid=" + conid;
}
function clk_task_view(taskid){
var oForm = document.operatorForm;
	var ret = window.showModalDialog('../selectFrm.htm','task_mgt/task_view.jsp?taskid='+taskid,'dialogHeight: 500px;dialogWidth: 800px; center: yes; status:no;help: no');



}
</script>
</head>

<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td >
     <form name="operatorForm" method="post" onSubmit="return clk_submit();">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td height="100" align="center" valign="top" style="padding-top:10px;padding-bottom:10px;">
            <table width="98%" border="0" cellpadding="1" cellspacing="1" bgcolor="#000000">
			
			
               <%if (!strErr.trim().equals("")) {%>
              <tr> 
                <td height="24" colspan="7" bgcolor="#D7D7DB" style="padding-left:10px;">
                  错误提示：
                 
                  <font color=red><%=strErr%></font>                </td>
              </tr>
              <%}%>
              
            
               <tr>
			    <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;"><font color="#FFFFFF">合同类型：</font></td>
			    <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
			 
			    <%=contract.getContype_name()%></td>
			    </tr>
		  <tr>
			    <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;"><font color="#FFFFFF">登记人：</font></td>
			    <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
			 
			    <%=contract.getCreateman_name()%></td>
			    
			    </tr>
		
             <tr> 
                <td width="21%" height="24" align="right" bgcolor="#858585" style="padding-right:5px;"><font color="#FFFFFF">所在区域：</font></td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;">
                  <%=contract.getArea()%>
                  
               </td>
              </tr>
              <tr> 
                <td width="21%" height="24" align="right" bgcolor="#858585" style="padding-right:5px;">
                <font color="#FFFFFF">合同编号：</font></td>
                <td width="79%" colspan="6" bgcolor="#EDEDF0" style="padding-left:5px;">
                <%=contract.getConid()%>
                 
                  &nbsp;&nbsp;</td>
              </tr>
			  
              <tr> 
                <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;"> <font color="#FFFFFF">服务合同号：</font></td>
                <td colspan="6" bgcolor="#EDEDF0" style="padding-left:5px;"> 
              <%=contract.getServiceid()%>
                 
                 </td>
              </tr>
              <tr>
                <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;"><font color="#FFFFFF">客户名称：</font></td>
                <td colspan="6" bgcolor="#EDEDF0" style="padding-left:5px;">
         <%=contract.getCustomer()%>
                
                </td>
              </tr>
  
                 <tr>
                   <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;" ><font color="#FFFFFF">联系人：</font></td>
                   <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
                   
                   
                 <%=contract.getLinkman()%></td>
                 </tr>
                 <tr>
                   <td height="23" align="right" bgcolor="#858585" style="padding-right:5px;" ><font color="#FFFFFF">联系电话：</font></td>
                   <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
                   
                 <%=contract.getPhone()%></td>
                 </tr>
                 <tr>
                   <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;" ><font color="#FFFFFF">销售员：</font></td>
                   <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
                  <%=contract.getSale_name()%></td>
                 </tr>
                
                 
                 <tr> 
                <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;" ><font color="#FFFFFF">合同开始执行时间：</font></td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
                <span id="htmlSaleTime"> 
                  	 <%=contract.getBegindate()%>          </td>
              </tr>
             
               <tr> 
                <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;" ><font color="#FFFFFF">合同到期时间：</font></td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
              <%=contract.getEnddate()%>           </td>
              </tr>
              
			  <tr>
			    <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;"><font color="#FFFFFF">合同服务等级：</font></td>
			    <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
			  
					 <%=contract.getSevgrade().getSgname()%>	   
					 
					 
					 
					  </td>
			    </tr>
			  <tr>
			    <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;"><font color="#FFFFFF">合同描述：</font></td>
			    <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
			    <%=contract.getContractdesc()%></td>
			    </tr>
			  
			 
			    <tr>
			    <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;"><font color="#FFFFFF">厂商名称：</font></td>
			    <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
			    <%=contract.getCom_name()%></td>
			    </tr>
			    <tr>
			    <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;"><font color="#FFFFFF">项目经理：</font></td>
			    <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
			    <%=contract.getTechmanager_name()%></td>
			    </tr>
			   <%if(! contract.getEngineer().trim().equals("")){%>
			    <tr>
			    <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;"><font color="#FFFFFF">工程师：</font></td>
			    <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
			    <%=contract.getEngineer_name()%></td>
			    </tr>
		
			  <tr>
			    <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;"><font color="#FFFFFF">分配工程师时间：</font></td>
			    <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
			    <%=contract.getAssigntime()%></td>
			    </tr>
			  <%}%>
			   <tr>
			    <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;">
			    <font color="#FFFFFF">合同分析报告：</font></td>
			    <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
			    <%
						String savePath="upload/analyreport";
						String fileName=contract.getAnalyreport();
						File fileSave = new File(pageContext.getServletContext().getRealPath(savePath + "/" + fileName));
			if (fileSave.exists()) {
						%>
			    	<a href="do_download.jsp?filename=upload/analyreport/<%=contract.getAnalyreport()%>" > <%=contract.getAnalyreport()%></a>
			    	
			    	<%}else{%>
					此附件已被删除
					<%}%>
			    	</td>
			    </tr>
			    <tr>
			    <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;">
			    <font color="#FFFFFF">技术支援单：</font></td>
			    <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
			    	<%
						 savePath="upload/techsupport";
						 fileName=contract.getTechsupport();
						 fileSave = new File(pageContext.getServletContext().getRealPath(savePath + "/" + fileName));
			if (fileSave.exists()) {
						%>
			    	<a href="do_download.jsp?filename=upload/techsupport/<%=contract.getTechsupport()%>" > <%=contract.getTechsupport()%></a>
			    	
			    	<%}else{%>
					此附件已被删除
					<%}%>
			    	</td>
			    </tr>
                <tr> 
                <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;">
                <font color="#FFFFFF">合同附件文件：</font></td>
                <td colspan="6" bgcolor="#EDEDF0" style="padding-left:5px;">
              	<%
						 savePath="upload/contractfile";
						 fileName=contract.getContractlile();
						 fileSave = new File(pageContext.getServletContext().getRealPath(savePath + "/" + fileName));
			if (fileSave.exists()) {
						%>
              	
              	<a href="do_download.jsp?filename=upload/contractfile/<%=contract.getContractlile()%>" > <%=contract.getContractlile()%></a>
					<%}else{%>
					此附件已被删除
					<%}%>
				</td>
              </tr>
            
			    <tr>
                   <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;" >
                   <font color="#FFFFFF">初次安装费：</font></td>
                   <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
             	<%=FormatNum.formatCurrencycn(contract.getFifee())%></td>
                </tr>
			    <tr>
			      <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;" >
			      <font color="#FFFFFF">(1-3年)现场维护：</font></td>
			      <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
			    <%=FormatNum.formatCurrencycn(contract.getMfee())%></td>
		        </tr>
			    <tr>
			      <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;" >
			      <font color="#FFFFFF">现场维护年限：</font></td>
			      <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
			    <%=contract.getMyear()%>年</td>
		        </tr>
		        <%if(contract.getContype()==2){%>
		        <tr>
			      <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;" >
			      
			      <font color="#FFFFFF">签约金额：</font></td>
			      <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
			   <%=FormatNum.formatCurrencycn(contract.getSignfee())%></td>
		        </tr>
		        <%}%>
			    <tr>
			      <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;" >
			      
			      <font color="#FFFFFF">备件成本：</font></td>
			      <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
			    <%=FormatNum.formatCurrencycn(contract.getSpartfee())%></td>
		        </tr>
			    <tr>
			      <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;" >
			      <font color="#FFFFFF">外部人员技术成本：</font> </td>
			      <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6" >
			     <%=FormatNum.formatCurrencycn(contract.getOutefee())%></td>
		        </tr>
                
                <tr>
                  <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;">
                  <font color="#FFFFFF">培训时间：</font>  
				 </td>
                  <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
				  
				  从<%=contract.getTechbegindate()%>
 							至 	
							 <%=contract.getTechenddate()%>
				  
				  &nbsp;</td>
                </tr>
                <tr>
                  <td height="24" align="right" bgcolor="#858585" style="padding-right:5px;">
                  <font color="#FFFFFF">专业化服务时间：</font></td>
                  <td bgcolor="#EDEDF0" style="padding-left:5px;" colspan="6">
				  
				  从<%=contract.getSevbegindate()%>
 							至 	

                 <%=contract.getSevenddate()%>
				  
				  &nbsp;</td>
                </tr>
                <tr> 
                <td height="24" colspan="7" bgcolor="#858585" style="padding-left:10px;">
                  <font color="#FFFFFF"><strong>工程师信息</strong></font> &nbsp;&nbsp;
                
                </td>
              </tr>
               <tr align="center" valign="top" bgcolor="#EDEDF0"> 
                <td height="20" colspan="7" id="htmlDeviceInfo"> 
                
                  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#EDEDF0" id="tbDeviceDetail">
                    <tr align="center" bgcolor="#D7D7DB"> 
                     <td width="18%" height="23" bgcolor="#D7D7DB"> 工程师姓名</td>
                      <td width="13%">工程师E-mail</td>
                      <td width="22%">工程师电话</td>
                      <td width="9%">工单状态</td>
                       <td width="9%">详情</td>
                    </tr>
                <%
                   List list = contract.getListEngs();
                    if (list != null && list.size() > 0) {
                    	for(int i=0;i<list.size();i++) {
                    		Techconeng techEng = (Techconeng)list.get(i);
                    		
                    %>
                    <tr align="center" bgcolor="#FFFFFF">
                      <td height="24"><%=techEng.getEng_name()%></td>
                      <td><%=techEng.getUser().getEmail()%></td>
                      <td><%=techEng.getUser().getPhone()%></td>
                      <td> <%=techEng.getTaskStatus_name()%> </td>
                      
                       <td>
                       <% if(techEng.getTaskid()!=0){%>
                        <span onclick="clk_task_view('<%=techEng.getTaskid()%>');"
							style="cursor:hand;text-decoration: underline;">查看</span>
							<%}%>
							</td>
                    	
            </tr>
                    <%}}%>
                  </table>
                </td>
              </tr>
              <tr> 
                <td bgcolor="#EDEDF0" colspan="7" align="center">
                
            <% if (strErr.trim().equals("") && just_user.hasPower(power2_enable_id)) {%>
                <%if(pala.isAnalysis(Integer.parseInt(conid))==false){%>
              <input type="button" onclick="clk_anaysis('<%=contract.getConid()%>','<%=contract.getSpartfee()%>','<%=contract.getOutefee()%>');" name="btn" value="创建损益分析" class="inputButton">  
                 <%}else if(pala.isAnalysis(Integer.parseInt(conid))==true){%>
                   <input type="button" onclick="clk_view_anaysis('<%=contract.getConid()%>');" name="btn" value="查看损益分析" class="inputButton">  
                  <%}}%>
                     <input type="button" onclick="clk_goback();" name="btn" value="返　回" class="inputButton"> 
                          <input type="hidden" name="pageno" value="<%=pageno%>">
                  </td>
              </tr>
            </table>
          </td>
        </tr>
       
      </table>
      </form>
    </td>
  </tr>
</table>

</body>
</html>
